package LC;

import java.util.ArrayList;

/**
 * @ClassName LC98
 * @Description: TODO
 * @Author hl
 * @Date 2020/5/26
 * @Version V1.0
 **/
public class LC98 {
    public static void main(String[] args) {

    }

    public boolean isValidBST(TreeNode root) {
        ArrayList<Integer> list=new ArrayList<>();

        seach(root,list);
        for(int i=0;i<list.size()-1;i++){
            if(list.get(i)>=list.get(i+1)){
                return  false;
            }
        }
        return true;


    }
    public ArrayList<Integer> seach(TreeNode root,ArrayList<Integer> list){
        if(root==null){
           return list;
        }

        seach(root.left,list);
        list.add(root.val);
        seach(root.right,list);
          return  list;
    }

}
